package com.xudow.app.ui;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.xudow.app.R;

/**
 * 支付结果弹出窗口
 *
 * @author lukecheng
 */
public class PayStatusPopup extends PopupWindow {

    public PayStatusPopup(Context context, int iconRes, String message) {
        super(context);

        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View contentView = inflater.inflate(R.layout.layout_pay_status_popup, null);

        setContentView(contentView);

        setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
        setFocusable(true);
        setAnimationStyle(R.style.PopupAnimation);

        ColorDrawable dw = new ColorDrawable(0xb0000000);
        setBackgroundDrawable(dw);

        ((ImageView) contentView.findViewById(R.id.icon)).setImageResource(iconRes);
        ((TextView) contentView.findViewById(R.id.message)).setText(message);
    }
}
